<include file="public@header" />
<style type="text/css">
    .form-search label{width:300px;}
    .form-search label.date{width:300px;}
    .form-search input.js-date{width:80px;}
    .form-search select{width:auto !important;}

    .form-horizontal .control-label {width:100px;}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('orders/visua')}">{:lang('可视化墓区')}</a></li>
        <li class="active"><a  href="">墓位信息</a></li>
    </ul>
    <form  class="form-horizontal js-ajax-form" method="post" data-action="{:url('Orders/sale')}" enctype="multipart/form-data" style="width:80%;float:left;">
        <fieldset>
            <div class="p_title">
                <span class="span_title">墓位详情</span>
            </div>
            <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;">
                <div class="form-group">
                    <label class="control-label">壁式：</label>
                    <div class="col-lg-2">
                        <select class="form-control" name="tomb[funeral]"   >
                            <foreach name="tomb_funeral.st" item="vo">
                                <option value="{$vo}" <if condition="$vo eq  $result['funeral'] ">selected </if>>{$vo}</option>
                            </foreach>
                        </select>
                    </div>
                    <label class="control-label">占地面积：</label>
                    <div class="col-lg-2">
                        <input type="text" style="width: 150px;" class="form-control" name="footprint" disabled value="{$result.footprint|default=''}" >m²
                    </div>
                    <label class="control-label">墓穴规制：</label>
                    <div class="col-lg-2">
                        <select class="form-control" name="tomb_regulation" disabled style="width: 150px;">
                            <foreach name="tomb_regulation" item="vo">
                                <option value="{$vo.id}" <if condition="$vo.id eq  $result['tomb_regulation'] ">selected </if>>{$vo.name}</option>
                            </foreach>
                        </select>
                    </div>
                    <label class="control-label">收敛形式：</label>
                    <div class="col-lg-2">
                        <select class="form-control" name="tomb[convergence]" style="width: 150px;">
                            <foreach name="tomb_convergence.st" item="vo">
                                <option value="{$vo}" <if condition="$vo eq  $result['convergence'] ">selected </if>>{$vo}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">售后质保期：</label>
                    <div class="col-lg-2">
                        <select class="form-control" name="warranty" disabled>
                            <option value="3" >购买起计3年</option>
                        </select>
                    </div>
                    <label class="control-label">墓穴维护期：</label>
                    <div class="col-lg-2">
                        <select class="form-control" name="maintain" disabled>
                            <option value="20" >首位安葬起20年</option>
                        </select>
                    </div>
                    <label class="control-label"> 类型：</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="" disabled value="{$cate_name}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">备注</label>
                    <div class="col-lg-10">
                        <textarea type="text" class="form-control" rows="2" cols="45" disabled style="width:400px;" name="remark" placeholder="输入墓位信息备注" >{$result.remark|default=''}</textarea>
                    </div>
                </div>
            </div>
            <div class="p_title">
                <span class="span_title">订单详情</span>
                <input type="hidden" name="order[order_id]" value="{$result.order_id|default=''}">
                <input type="hidden" name="order[tomb_product_id]" value="{$result.id}">
                <input type="hidden" name="order[tomb_type]" value="{$cate_id}">
                <input type="hidden" name="order[tomb_id]" value="{$result.colID|default=''}">
                <input type="hidden" name="order[tomb_num]" value="{$result.num|default=''}">
                <input type="hidden" name="order[orders_id]" value="{$orders_id|default=''}">
            </div>
            <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;">

                <div class="form-group">
                    <label class="control-label">墓位编号</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" disabled value="{$result.num|default=''}">
                    </div>

                    <label class="control-label">所在区域</label>
                    <div class="col-lg-2">
                        <input type="text" name="tomb_region" class="form-control" value="{$result.tomb_region|default=''}" disabled>
                    </div>
                    <label class="control-label">具体位置</label>
                    <div class="col-lg-2">
                        <input type="text"  class="form-control" name="tomb_address" value="{$result.tomb_address|default=''}{$result.layer_num|default=''}层" disabled>
                    </div>
                    <label class="control-label">墓位状态</label>
                    <div class="col-lg-2">
                        <input type="text"  class="form-control" name="tomb_status" value="{$result.tomb_status|default=''}" disabled >
                    </div>
                </div>
                <div class="form-group">

                    <label class="control-label">销售价格</label>
                    <div class="col-lg-2">
                        <input type="hidden" class="selling_price"  name="order[selling_price]" value="{$result.selling_price|default='0'}">
                        <input type="text"  class="form-control selling_price" value="{$result.selling_price|default=''}" disabled >
                    </div>
                    <label class="control-label">补贴减免</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control discount_ratio" name="order[discount_ratio]"  id="discount_ratio"  value="{$result.discount_ratio|default='0'}" >
<!--                        <input type="hidden" class="form-control "  id="discount_ratio_" >-->
                    </div>
                    <label class="control-label"style="">免零金额</label>
                    <div class="col-lg-2" >
                        <input type="text"  name="order[free_price]"  class="form-control free_price" value="{$result.free_price|default='0'}" <if condition="$result.reacher">disabled <else/>    </if>   >
                    </div>
                    <label class="control-label">成交价格 </label>
                    <div class="col-lg-2">
                        <input type="hidden" class=" closing_price"   name="order[closing_price]" value="{$result.closing_price|default='0'}">
                        <input type="text" class="form-control closing_price"    value="{$result.closing_price|default='0'}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">下单时间</label>
                    <div class="col-lg-2" style="width: 13%">
                        <input type="hidden"   name="add_time" value="{$result.add_order_time}" >
                        <input type="text" style="width: 100%"  class="form-control js-date"  value="{$result.add_order_time}" disabled >
                    </div>
                    <label class="control-label"style="width: 78px">导购员</label>
                    <div class="col-lg-2" style="width: 12%">
                        <input type="hidden"   name="order[shoppingguide]" value="{$result.shoppingguide}" >
                        <input type="text" class="form-control" name="shoppingguide"   disabled value="{$result.shoppingguide_name}">
                    </div>
                    <label class="control-label">代理商</label>
                    <div class="col-lg-2">
                        <select name="order[agent_user]"   class="form-control">
                            <option value="0">请选择</option>
                            <foreach name="dailishang_list" item="vou">
                                <if condition=" isset($result['agent_user'])">
                                    <option value="{$vou.id}" <if condition=" $result['agent_user'] eq $vou.id"> selected </if>>{$vou.department_name}-{$vou.user_nickname}</option>
                                    <else/>
                                    <option value="{$vou.id}">{$vou.department_name}-{$vou.user_nickname}</option>
                                </if>
                            </foreach>
                        </select>
                    </div>
                    <label class="control-label" style="width: 78px"> 抵顶人</label>
                    <div class="col-lg-2" style="width: 8%">
                        <input type="text" style="width: 100%"  class="form-control" name="reaching" value="{$result.reacher|default=''}"  disabled>
                    </div>
                    <label class="control-label" style="width: 78px">经办人 </label>
                    <div class="col-lg-2" style="width: 8%">
                        <input type="hidden"   name="order[handle]" value="{$result.handle|default=''}" >
                        <input type="text" style="width: 100%" class="form-control" name="handle" value="{$result.handle_name|default=''}" disabled>
                    </div>
                </div>
            </div>
        </fieldset>

        <div class="form-actions" style="clear:both;">
            <!--        <div class="btn btn-primary " id="check-btn">下一步</div>-->
            <button type="submit" class="btn btn-primary js-ajax-submit">下一步</button>
        </div>
    </form>
    <div style="width:20%; float:left">
        <php>$img_cer=cmf_get_image_preview_url(isset($result['tom_img'])?$result['tom_img']:'');$img_cer=$img_cer?$img_cer:'__TMPL__/public/assets/images/1.png'</php>
        <img src="{$img_cer}" class="preview" style="max-width:200px; display:block; margin:0 auto;"/>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<script>
    $(function () {
        var discount_ratio = $('.discount_ratio').val(),
            selling_price = $('.selling_price').val(),
            free_price = $('.free_price').val(),
            closing_price =selling_price-discount_ratio-free_price ;
        $('.closing_price').val( parseFloat(closing_price).toFixed(2))
    });

    $('.discount_ratio').blur(function () {
        var discount_ratio =  $('#discount_ratio').val(),
            free_price = $('.free_price').val(),
            selling_price = $('.selling_price').val(),
            closing_price =selling_price - discount_ratio-free_price ;
        $('.closing_price').val( parseFloat(closing_price).toFixed(2));
    })
    $('.free_price').blur(function () {
        var free_price  = $(this).val();
        if(free_price >= 100){
            layer.msg('减免金额不能超过100元');
        }else {
            var discount_ratio = $('#discount_ratio').val();
            var receivable_price = Number(
                ((Number($('.selling_price').val().replace(/,/g, "")).toFixed(2)*1 )- discount_ratio)-
                Number(free_price.replace(/,/g,"")).toFixed(2)*1
            );
            $(".closing_price").val(receivable_price.toFixed(2));

        }
    })

</script>
</body>
</html>